define([
    "UtilDir/util",
    "UtilDir/tool",
    "UtilDir/dialog",
    "UtilDir/combotree",
    "UtilDir/org/selectOrg",
    "UtilDir/searchBlock",
    "FwDir/util/js/bootstrap-select",
    "EasyUI", "EasyUI-lang"
], function (Util, Tool, Dialog, Combotree, OrgUtil, SearchBlock) {

    var sysPath = getServer() + "/static/app/fwsjcj";
    var getZwController = function () {
        return getServer() + "/fw/taskForm";
    };
    var TaskFormHtml = sysPath + "/censusquality/views/taskForm.html";
    var formList = sysPath + "/censusquality/views/formList.html";
    var getDivisionController = function () {
        return getServer() + "/platform/org/divisions/";
    };
    var docData;
    /**
     * 页面初始化
     */
    var init = function () {
        initSearchBlock();
        queryBtnBind();
        createTaskGrid();
        //浏览器窗口大小变化后，表格宽度自适应
        $(window).resize(function () {
            createTaskGrid();
        });
    };
    var initSearchBlock = function () {
        SearchBlock.init("searchBlock");
    };
    var queryBtnBind = function () {
        $("#btnSearch").click(function () {
            createTaskGrid();
        });
        $("#btnReset").click(function () {
            $("#qualityStatus").val("");
            $("#taskName").val("");
        });
    };

    /**
     * 质检管理任务分页
     */
    var createTaskGrid = function () {
        $("#taskGrid").datagrid({
            url: getServer() + "/quality/task/page/user",
            method: "GET",
            nowrap: false,
            columns: [
                [{
                    field: "ck",
                    checkbox: true
                },
                    {
                        field: 'taskNum',
                        title: '任务编号',
                        width: '20%',
                        align: 'center'
                    },
                    {
                        field: 'taskName',
                        title: '任务名称',
                        width: '29%',
                        align: 'center',
                        formatter: function (value, rowData, rowIndex) {
                            return '<a href="#" onclick="_viewQTask(\'' + rowData.taskId + '\',\'' + rowData.groupId + '\')"> ' + rowData.taskName + ' </a> '

                        }
                    },
                    /*{
						field: 'division',
						title: '任务地区',
						width: '20%',
						align: 'center'
					},*/
                    {
                        field: 'groupName',
                        title: '任务小组',
                        width: '20%',
                        align: 'center'
                    },
                    {
                        field: 'qualityStatus',
                        title: '任务状态',
                        width: '10%',
                        align: 'center',
                        formatter: function (value, rowData, rowIndex) {
                            if (value == '1') {
                                return '未质检';
                            } else if (value == '2') {
                                return '质检中';
                            } else if (value == '3') {
                                return '质检完成';
                            }
                        }
                    },
                    {
                        field: 'operation',
                        title: '操作',
                        width: '19.8%',
                        align: 'center',
                        formatter: function (value, rowData, rowIndex) {
                            return '<a onclick="_formlist(\'' + rowData.taskId + '\',\'' + rowData.taskName + '\',\'' + rowData.qualityStatus + '\')">表单列表</a>';
                        }
                    }
                ]
            ],
            queryParams: {
                qualityStatus: $("#qualityStatus").val(),
                taskName: $("#taskName").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };

    // 查看任务详情
    window._viewQTask = function (taskId, groupId) {
        debugger;
        var slidebar = Util.slidebar({
            url: TaskFormHtml,
            width: "580px",
            cache: false,
            close: true,
            afterLoad: function () {
                // 查看任务详情
                getTask(taskId);
                //查看队员列表
                $("#viewteamBtn").bind("click", function () {
                    var buttons = [];
                    buttons.push({
                        name: '确定',
                        callback: function () {
                            //点击确定
                            dialog.hide();
                        }
                    });
                    var dialog = Dialog({
                        id: "viewTeamDialog",
                        cache: false,
                        title: '队员情况', //dialog标题
                        width: "1000px",
                        height: "550px",
                        body: '<div id="TeamGrid"></div>',
                        buttons: buttons,
                        afterOpen: function () {
                            $("#TeamGrid").datagrid({
                                url: getServer() + "/fw/group/" + groupId,
                                method: "GET",
                                height: "515px",
                                fitColumns: true,
                                nowrap: false,
                                autoRowHeight: false,
                                singleSelect: true,
                                columns: [[
                                    {field: 'relName', title: '姓名', width: '18%', align: 'center'},
                                    {field: 'idNumber', title: '身份证号', width: '28%', align: 'center'},
                                    {field: 'mobilePhone', title: '手机号', width: '23%', align: 'center'},
                                    {field: 'groupZW', title: '队内职务', width: '15%', align: 'center'},
                                    {field: 'formNum', title: '完成表单数量', width: '18%', align: 'center'},
                                ]],
                                pagination: false,
                                pageSize: 10
                            });
                        }
                    });
                    dialog.show();
                });
            }
        });
    };

    // 查看任务详情
    var getTask = function (id) {
        $.ajax({
            url: getServer() + "/fw/task/" + id,
            type: "get",
            success: function (data) {
                Tool.deserialize("taskForm", data);
            }
        });
    };

    window._formlist = function (taskId, taskName, status) {
        debugger;
        var slidebar = Util.slidebar({
            url: formList,
            width: "1250px",
            cache: false,
            close: true,
            afterOpen: function () {
                createFormGrid(taskId, taskName);
            },
            afterLoad: function () {
                $("#saveBtn").on("click", function () {
                    debugger;
                    if (status != 2) {
                        Util.alert("只有数据状态为质检中的才能质检!");
                        return;
                    } else {
                        $.ajax({
                            url: getServer() + "/quality/inspection/" + taskId,
                            contentType: "application/json",
                            type: "post",
                            success: function (data) {
                                Util.alert(data.message);
                                //									slidebar.close();
                                createFormGrid(taskId, taskName);
                                createTaskGrid();
                            }
                        });
                    }
                });
            }
        });
    };

    /**
     * 查看任务下的普查列表
     */
    var createFormGrid = function (taskId, taskName) {
        var opts1;
        //  	var taskId = taskId;
        //  	var taskName = taskName;
        $("#formListGrid").datagrid({
            url: getServer() + "/quality/pc/page",
            method: "get",
            nowrap: false,
            columns: [
                [{
                    field: "ck",
                    checkbox: true
                },
                    {
                        field: 'myNo',
                        title: '序号',
                        align: 'center',
                        width: '4%',
                        formatter: function (value, row, index) {
                            if (!opts1) {
                                opts1 = $('#formListGrid').datagrid('options');
                            }
                            return opts1.pageSize * (opts1.pageNumber - 1) + index + 1;
                        }
                    },
                    {
                        field: 'taskName',
                        title: '所属任务',
                        width: '15%',
                        align: 'center'
                    },
                    {
                        field: 'buildingCode',
                        title: '建筑物编号',
                        width: '15%',
                        align: 'center'
                    },
                    {
                        field: 'buildingAddress',
                        title: '所属地区',
                        width: '15%',
                        align: 'center'
                    },
                    {
                        field: 'bulidingType',
                        title: '建筑物类别',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0) {
                                return '城镇住宅';
                            } else if (value == 1) {
                                return '城镇非住宅';
                            } else if (value == 2) {
                                return '农村住房';
                            } else if (value == 3) {
                                return '农村公共住宅';
                            }
                        }
                    },
                    {
                        field: 'buildingName',
                        title: '建筑物名称',
                        width: '15%',
                        align: 'center'
                    },
                    {
                        field: 'qualityStatus',
                        title: '数据状态',
                        width: '8%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0) {
                                return '未完成';
                            } else if (value == 1) {
                                return '未质检';
                            } else if (value == 2) {
                                return '质检通过';
                            } else if (value == 3) {
                                return '质检不通过';
                            }
                        }
                    },
                    {
                        field: 'collecPerson',
                        title: '数据采集人',
                        width: '7%',
                        align: 'center'
                    },
                    {
                        field: 'operation',
                        title: '操作',
                        width: '10%',
                        align: 'center',
                        formatter: function (value, rowData, rowIndex) {
                            return '<a onclick="_view(\'' + rowData.formId + "','" + rowData.bulidingType + "','" + rowData.qualityStatus + '\')">查看表单</a >';
                        }
                    }
                ]
            ],

            queryParams: {
                taskId: taskId,
            },
            pagination: true,
            pageSize: 10
        });
    };
    // 查看表单
    window._view = function (formId, category, status) {
        debugger;
        // var censusDataHtml = sysPath + "/censusdata/views/censusForm_city.html";
        var censusDataHtml = openForm(category);
        var slidebar = Util.slidebar({
            url: censusDataHtml,
            width: "900px",
            cache: false,
            close: true,
            afterLoad: function () {
                getData(formId, category, status);
                // getRole(roleId);
            }
        });
    };
    // 判断打开那个表单--查看表单
    var openForm = function (type) {
        var openform;
        if (type == '0') {
            // 城镇住宅
            openform = sysPath + "/censusquality/views/censusForm_city.html";
        } else if (type == '1') {
            // 城镇非住宅
            openform = sysPath + "/censusquality/views/censusForm_uncity.html";
        } else if (type == '2') {
            // 农村住房
            openform = sysPath + "/censusquality/views/censusForm_rural.html";
        } else if (type == '3') {
            // 农村公共建筑
            openform = sysPath + "/censusquality/views/censusForm_publicrural.html";
        }
        return openform;
    }
    // 查看获取数据
    var getData = function (id, type, status) {
        debugger;
        $.ajax({
            url: getZwController() + "/findById",
            data: {
                type: type,
                formId: id
            },
            type: "get",
            success: function (data) {

                Tool.deserialize("userForm", data);
                if (status == 3) {
                    $('#unapproval_reason').show();
                    $("#qualityReason").val(data.qualityReason);
                }
                if (data.propertyNature == '其它') {
                    $('#propertyNatureOther').css('display', 'block');
                }
                if (data.housePurpose == '其它') {
                    $('#housePurposeOther').css('display', 'block');
                }
                if (data.structureType == '其它') {
                    $('#structureTypeOther').css('display', 'block');
                }
                if (data.image != '') {
                    $('#image').attr('src', data.image);
                }
            }
        });
    }
    var selectType = function (taskId, taskName) {
        var buttons = [];
        buttons.push({
            name: '确定',
            callback: function () {
                //点击确定
                var formType = $("#formType").val();
                uploadZw(formType, taskId, taskName);
                dialog.hide();
            }
        });
        var dialog = Dialog({
            id: "viewTeamDialog",
            cache: false,
            title: '选择表单类型', //dialog标题
            width: "400px",
            height: "250px",
            body: '<div id="TeamGrid">' +
                '<div class="col-md-12 form-horizontal">' +
                '<div class="form-group">' +
                '<label for="formType" class="col-md-4 control-label"> </span>表单类型:</label>' +
                '<div class="col-md-8">' +
                '<select class="form-control" id="formType" name="formType" >' +
                '<option value="" disabled selected style="display:none;">请选择</option>' +
                '<option value="0">砖混结构、砖木结构</option>' +
                '<option value="1">多层钢筋混凝土机构</option>' +
                '<option value="2">高层结构</option>' +
                '<option value="3">工业厂房结构</option>' +
                '<option value="4">空旷结构</option>' +
                '<option value="5">土木结构</option>' +
                '<option value="6">木结构</option>' +
                '<option value="7">石结构</option>' +
                '</select>' +
                '</div>' +
                '</div>' +
                '</div>' +
                '</div>',
            buttons: buttons,
            afterOpen: function () {

            }
        });
        dialog.show();
    };
    var exportZw = function () {
        window.location.href = getZwController() + "exportFile";
    };

    var newForm = function (taskId, taskName) {
        debugger;
        var buttons = [];
        buttons.push({
            name: '确定',
            callback: function () {
                //点击确定

                var formType = $("#formType").val();
                debugger;
                openForm(formType, taskId, taskName);

                dialog.hide();
            }
        });
        var dialog = Dialog({
            id: "viewTeamDialog",
            cache: false,
            title: '选择表单类型', //dialog标题
            width: "400px",
            height: "250px",
            body: '<div id="TeamGrid">' +
                '<div class="col-md-12 form-horizontal">' +
                '<div class="form-group">' +
                '<label for="formType" class="col-md-4 control-label"> </span>表单类型:</label>' +
                '<div class="col-md-8">' +
                '<select class="form-control" id="formType" name="formType" >' +
                '<option value="" disabled selected style="display:none;">请选择</option>' +
                '<option value="0">砖混结构、砖木结构</option>' +
                '<option value="1">多层钢筋混凝土机构</option>' +
                '<option value="2">高层结构</option>' +
                '<option value="3">工业厂房结构</option>' +
                '<option value="4">空旷结构</option>' +
                '<option value="5">土木结构</option>' +
                '<option value="6">木结构</option>' +
                '<option value="7">石结构</option>' +
                '</select>' +
                '</div>' +
                '</div>' +
                '</div>' +
                '</div>',
            buttons: buttons,
            afterOpen: function () {

            }
        });
        dialog.show();
    };
    var deleteFm = function (taskId, taskName) {
        var rows = $("#formListGrid").datagrid("getSelections");
        if (rows == null || rows.length == 0) {
            Util.alert("请选择一行数据!");
            return;
        }
        if (rows.length >= 1) {
            for (var i = 0; i < rows.length; i++) {
                if (rows[i].status != '0') {
                    Util.alert("只有数据状态为未提交的才能删除!");
                    return;
                }
            }
        }
        Util.confirm("是否要删除选中的表单?", function () {
            var ids = "";
            $.each(rows, function (i, row) {
                ids += row.id + ",";
            });
            ids = ids.substr(0, ids.length - 1);
            $.ajax({
                url: getServer() + "/fw/structure/del",
                contentType: "application/json",
                data: ids,
                type: "post",
                success: function (data) {
                    createFormGrid(taskId, taskName);
                }
            });
        }, function () {
            return;
        });

    };
    //提交
    var submit = function (taskId, taskName) {
        var rows = $("#formListGrid").datagrid("getSelections");
        if (rows == null || rows.length == 0) {
            Util.alert("请选择一行数据!");
            return;
        }
        if (rows.length >= 1) {
            for (var i = 0; i < rows.length; i++) {
                if (rows[i].status != '0') {
                    Util.alert("只有数据状态为未提交的才能提交!");
                    return;
                }
            }
        }
        Util.confirm("是否要提交选中的表单?", function () {
            var ids = "";
            $.each(rows, function (i, row) {
                ids += row.id + ",";
            });
            ids = ids.substr(0, ids.length - 1);
            $.ajax({
                url: getServer() + "/fw/structure/submit",
                contentType: "application/json",
                data: ids,
                type: "post",
                success: function (data) {
                    createFormGrid(taskId, taskName);
                }
            });
        }, function () {
            return;
        });

    };
    //获取样本编号
    var getFormNum = function (type) {
        $.ajax({
            url: getServer() + "/fw/structure/structureCode",
            type: "get",
            success: function (data) {

                $("#brickStructureNum").val(data);
                $("#mulConcreteStructureNum").val(data);
                $("#highStructureNum").val(data);
                $("#factoryStructureNum").val(data);
                $("#wideStructureNum").val(data);
                $("#buildingStructureNum").val(data);
                $("#woodStructureNum").val(data);
                $("#stoneStructureNum").val(data);
            }
        });
    };
    //查看表单
    window._viewForm = function (taskId, taskName, type, id, status) {
        debugger;
        var siftViewDataHtml = openCheckForm(type);
        var slidebar = Util.slidebar({
            url: siftViewDataHtml,
            width: "900px",
            cache: false,
            close: true,
            afterLoad: function () {
                debugger;
                $('.selectpicker').selectpicker();
                getForm(type, id, status);
                var url;
                var dom;

                if (type == '0') {
                    url = "/fw/brick/update";
                    dom = $("#brickForm");
                    brickFormValidator();
                } else if (type == '1') {
                    url = "/fw/mulConcrete/update";
                    dom = $("#concreteForm");
                    concreteFormValidator();
                } else if (type == '2') {
                    url = "/fw/high/update";
                    dom = $("#highStructureForm");
                    highStructureFormValidator();
                } else if (type == '3') {
                    url = "/fw/factory/update";
                    dom = $("#factoryForm");
                } else if (type == '4') {
                    url = "/fw/wide/update";
                    dom = $("#wideStructureForm");
                    wideStructureFormValidator();
                } else if (type == '5') {
                    url = "/fw/building/update";
                    dom = $("#buildingForm");
                    buildingFormValidator();
                } else if (type == '6') {
                    url = "/fw/wood/update";
                    dom = $("#woodForm");
                    woodFormValidator();
                } else if (type == '7') {
                    url = "/fw/stone/update";
                    dom = $("#stoneForm");
                    stoneFormValidator();
                }
                $("#saveBtn").on("click", function () {
                    if (dom.valid()) {
                        if (type == '0') {
                            var data = Tool.serialize("brickForm");
                        } else if (type == '1') {
                            var data = Tool.serialize("concreteForm");
                        } else if (type == '2') {
                            var data = Tool.serialize("highStructureForm");
                        } else if (type == '3') {
                            var data = Tool.serialize("factoryForm");
                        } else if (type == '4') {
                            var data = Tool.serialize("wideStructureForm");
                        } else if (type == '5') {
                            var data = Tool.serialize("buildingForm");
                        } else if (type == '6') {
                            var data = Tool.serialize("woodForm");
                        } else if (type == '7') {
                            var data = Tool.serialize("stoneForm");
                        }
                        if (status != 0) {
                            Util.alert("只有数据状态为未提交的才能修改!");
                            return;
                        } else {
                            $.ajax({
                                url: getServer() + url,
                                contentType: "application/json",
                                data: JSON.stringify(data),
                                type: "post",
                                success: function (data) {
                                    Util.alert(data.message);
                                    slidebar.close();
                                    createFormGrid(taskId, taskName);
                                }
                            });
                        }
                    }
                });
            }
        });
    };
    var getForm = function (type, id, status) {
        $.ajax({
            url: getServer() + "/fw/structure/getChild/" + id,
            type: "get",
            success: function (data) {
                debugger;
                console.log(data);

                editProvince(data.belongtoProvince, data.belongtoCity, data.belongtoArea);
                //				$('#belongtoProvince').val(data.belongtoProvince);
                //				$('#belongtoCity').val(data.belongtoCity);
                //				$('#belongtoArea').val(data.belongtoArea);
                if (type == 0) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("brickForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 1) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("concreteForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 2) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("highStructureForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 3) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("factoryForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 4) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("wideStructureForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 5) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("buildingForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 6) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("woodForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 7) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("stoneForm", data);
                    viewFileUpload(data.detailFile);
                }

            }
        });
    };
    var brickFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#brickForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                czType: {
                    required: true
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                wallMaterial: {
                    required: true
                },
                outWallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                inWallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                mortarType: {
                    required: true
                },
                mortarStrength: {
                    required: true
                },
                //              cwmgj:{
                //              	required :true
                //				},
                parapetInstall: {
                    required: true
                },
                ltjbz: {
                    required: true
                },
                czzPlace: {
                    required: true
                },
                jlInstall: {
                    required: true
                },
                jlbhqk: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                czType: {
                    required: "请选择承重方式"
                },
                roofType: {
                    required: "请选择屋盖类别"
                },
                floorType: {
                    required: "请选择楼盖类别"
                },
                wallMaterial: {
                    required: "请选择墙体材质"
                },
                outWallThick: {
                    required: "请填写外墙厚度"
                },
                inWallThick: {
                    required: "请填写内墙厚度"
                },
                mortarType: {
                    required: "请选择砂浆类型"
                },
                mortarStrength: {
                    required: "请选择砂浆强度"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                parapetInstall: {
                    required: "请选择女儿墙设置"
                },
                ltjbz: {
                    required: "请选择楼梯间布置"
                },
                czzPlace: {
                    required: "请选择构造柱位置"
                },
                jlInstall: {
                    required: "请选择圈梁设置"
                },
                jlbhqk: {
                    required: "请选择圈梁闭合情况"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var concreteFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#concreteForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                structureType: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                zhntqdLevel: {
                    required: true
                },
                zdzSpan: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                zdlkd: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                jlqhntqdLevel: {
                    required: true
                },
                jlqzdSpan: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                fillWallMaterial: {
                    required: true
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                frameStyle: {
                    required: true
                },
                mortarType: {
                    required: true
                },
                mortarStrength: {
                    required: true
                },
                cwmgj: {
                    required: true
                },
                parapetHeight: {
                    required: true
                },
                tcjyj: {
                    required: true
                },
                ltjbz: {
                    required: true
                },
                lzSituation: {
                    required: true
                },
                tcqSituation: {
                    required: true
                },
                baseSituation: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                structureType: {
                    required: "请选择结构形式"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                zhntqdLevel: {
                    required: "请选择柱混凝土强度等级"
                },
                jlqhntqdLevel: {
                    required: "请选择剪力墙混凝土强度等级"
                },
                roofType: {
                    required: "请选择屋盖类别"
                },
                floorType: {
                    required: "请选择楼盖类别"
                },
                fillWallMaterial: {
                    required: "请选择填充墙体材质"
                },
                wallThick: {
                    required: "请填写填充墙厚度"
                },
                frameStyle: {
                    required: "请选择框架形式"
                },
                mortarType: {
                    required: "请选择砂浆类型"
                },
                mortarStrength: {
                    required: "请选择砂浆强度"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                parapetHeight: {
                    required: "请选择女儿墙高度"
                },
                tcjyj: {
                    required: "请选择填充墙与柱"
                },
                ltjbz: {
                    required: "请选择楼梯间布置"
                },
                lzSituation: {
                    required: "请选择梁柱现状"
                },
                tcqSituation: {
                    required: "请选择填充墙现状"
                },
                baseSituation: {
                    required: "请选择基础现状"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var highStructureFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#highStructureForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                structureType: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                basementFloorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                skirtFloorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                skirtStructuralStyle: {
                    required: true
                },
                colConcreteStrengthGrade: {
                    required: true
                },
                maxColSpace: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                maxPurlinSpace: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                shearwellConcreteStrengthGrade: {
                    required: true
                },
                maxShearwellSpace: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                fillWallMaterial: {
                    required: true
                },
                wellThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                beamSituation: {
                    required: true
                },
                fillWellSituation: {
                    required: true
                },
                baseSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                structureType: {
                    required: "请选择结构形式"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                basementFloorNum: {
                    required: "请填写地下室层数"
                },
                skirtFloorNum: {
                    required: "请填写裙房层数"
                },
                skirtStructuralStyle: {
                    required: "请选择裙房结构形式"
                },
                colConcreteStrengthGrade: {
                    required: "请选择柱混凝土强度等级"
                },
                shearwellConcreteStrengthGrade: {
                    required: "请选择剪力墙混凝土强度等级"
                },
                roofType: {
                    required: "请选择屋盖类别"
                },
                floorType: {
                    required: "请选择楼盖类别"
                },
                fillWallMaterial: {
                    required: "请选择填充墙体材质"
                },
                wellThick: {
                    required: "请填写填充墙厚度"
                },
                beamSituation: {
                    required: "请选择梁柱现状"
                },
                fillWellSituation: {
                    required: "请选择填充墙现状"
                },
                baseSituation: {
                    required: "请选择基础现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var factoryFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#factoryForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                isSkylight: {
                    required: true
                },
                ringBeamNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                bentFrameColType: {
                    required: true
                },
                bentFrameColEqual: {
                    required: true
                },
                bentFrameNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                spans: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                bentFrameColSpace: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                topBentFrameSize: {
                    required: true
                },
                bottomBentFrameSize: {
                    required: true
                },
                colConcreteStrengthGrade: {
                    required: true
                },
                bentFrameSectionDatumMark: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofTrussThirdQuarterDatumMark: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofSystem: {
                    required: true
                },
                roofTrussStyle: {
                    required: true
                },
                hoistTon: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallMaterial: {
                    required: true
                },
                wallHeight: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                wallCol: {
                    required: true
                },
                roofTrussFirstQuarterStigma: {
                    required: true
                },
                yqgqlInstall: {
                    required: true
                },
                parapetHeight: {
                    required: true
                },
                zjzc: {
                    required: true
                },
                zSituation: {
                    required: true
                },
                wmgjSituation: {
                    required: true
                },
                fillWellSituation: {
                    required: true
                },
                baseSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                isSkylight: {
                    required: "请选择有无天窗"
                },
                ringBeamNum: {
                    required: "请填写圈梁道数"
                },
                bentFrameColType: {
                    required: "请选择排架柱类型"
                },
                bentFrameColEqual: {
                    required: "请选择排架柱是否等高"
                },
                bentFrameNum: {
                    required: "请填写排架跨数"
                },
                spans: {
                    required: "请填写各跨跨度"
                },
                bentFrameColSpace: {
                    required: "请填写排架柱距"
                },
                topBentFrameSize: {
                    required: "请填写排架柱上柱主要截面尺寸"
                },
                bottomBentFrameSize: {
                    required: "请填写排架柱下柱主要截面尺寸"
                },
                colConcreteStrengthGrade: {
                    required: "请选择柱混凝土强度等级"
                },
                bentFrameSectionDatumMark: {
                    required: "请填写排架柱变截面处标高"
                },
                roofTrussThirdQuarterDatumMark: {
                    required: "请填写屋架下弦标高"
                },
                roofSystem: {
                    required: "请选择屋盖体系"
                },
                roofTrussStyle: {
                    required: "请选择屋架形式"
                },
                hoistTon: {
                    required: "请填写吊车吨位"
                },
                wallMaterial: {
                    required: "请选择围护墙体材质"
                },
                wallHeight: {
                    required: "请填写围护墙体高度"
                },
                wallThick: {
                    required: "请填写围护墙体厚度"
                },
                wallCol: {
                    required: "请选择围护墙与柱拉结构造"
                },
                roofTrussFirstQuarterStigma: {
                    required: "请选择屋架端部上弦和柱顶圈梁设置"
                },
                yqgqlInstall: {
                    required: "请选择沿墙高圈梁设置"
                },
                parapetHeight: {
                    required: "请选择女儿墙高度"
                },
                zjzc: {
                    required: "请选择柱间支撑"
                },
                zSituation: {
                    required: "请选择柱现状"
                },
                wmgjSituation: {
                    required: "请选择屋面构件现状"
                },
                fillWellSituation: {
                    required: "请选择填充墙现状"
                },
                baseSituation: {
                    required: "请选择基础现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };

    var wideStructureFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#wideStructureForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                structureType: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wmType: {
                    required: true
                },
                wjGenre: {
                    required: true
                },
                ringBeamNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                colType: {
                    required: true
                },
                colSpan: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                colSpace: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                zzyjmSize: {
                    required: true
                },
                zhntqdLevel: {
                    required: true
                },
                zdbg: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                zbjmcbg: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wjxxbg: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallMaterial: {
                    required: true
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                wjdbbgc: {
                    required: true
                },
                yqgjlInstall: {
                    required: true
                },
                parapetHeight: {
                    required: true
                },
                wallCol: {
                    required: true
                },
                wtkqt: {
                    required: true
                },
                zjzc: {
                    required: true
                },
                lzSituation: {
                    required: true
                },
                wmgjSituation: {
                    required: true
                },
                fillWellSituation: {
                    required: true
                },
                baseSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                structureType: {
                    required: "请选择结构形式"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                wmType: {
                    required: "请选择屋面类别"
                },
                wjGenre: {
                    required: "请选择屋架形式"
                },
                ringBeamNum: {
                    required: "请填写圈梁道数"
                },
                colType: {
                    required: "请选择柱类型"
                },
                colSpan: {
                    required: "请填写柱跨度"
                },
                colSpace: {
                    required: "请填写柱距"
                },
                zzyjmSize: {
                    required: "请填写柱主要界面尺寸"
                },
                zhntqdLevel: {
                    required: "请选择柱混凝土强度等级"
                },
                zdbg: {
                    required: "请填写柱顶标高"
                },
                zbjmcbg: {
                    required: "请填写柱变截面处标高"
                },
                wjxxbg: {
                    required: "请填写屋架下弦标高"
                },
                wallMaterial: {
                    required: "请选择围护墙体材质"
                },
                wallThick: {
                    required: "请填写填充墙厚度"
                },
                wjdbbgc: {
                    required: "请选择屋架底部标高处圈梁设置"
                },
                yqgjlInstall: {
                    required: "请选择沿墙高圈梁设置"
                },
                parapetHeight: {
                    required: "请选择女儿墙高度"
                },
                wallCol: {
                    required: "请选择围护墙与柱拉结情况"
                },
                wtkqt: {
                    required: "请选择舞台口墙体"
                },
                zjzc: {
                    required: "请选择柱间支撑"
                },
                lzSituation: {
                    required: "请选择梁柱现状"
                },
                wmgjSituation: {
                    required: "请选择屋面构件现状"
                },
                fillWellSituation: {
                    required: "请选择填充墙现状"
                },
                baseSituation: {
                    required: "请选择基础现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var buildingFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#buildingForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallType: {
                    required: true
                },
                qtdqStyle: {
                    required: true
                },
                qtyxcl: {
                    required: true
                },
                windowWidth: {
                    required: true
                },
                czqMaxSpace: {
                    required: true
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                wmStyle: {
                    required: true
                },
                wmMaterial: {
                    required: true
                },
                ysge: {
                    required: true
                },
                wlgljcs: {
                    required: true
                },
                cwmgj: {
                    required: true
                },
                wallRingBeam: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                wallType: {
                    required: "请选择墙体类型"
                },
                qtdqStyle: {
                    required: "请选择墙体砌筑方式"
                },
                qtyxcl: {
                    required: "请选择墙体延性材料"
                },
                windowWidth: {
                    required: "请选择门窗洞口宽度"
                },
                czqMaxSpace: {
                    required: "请选择承重墙最大间距"
                },
                wallThick: {
                    required: "请填写墙体厚度"
                },
                wmStyle: {
                    required: "请选择屋面形式"
                },
                wmMaterial: {
                    required: "请选择屋面材料"
                },
                ysge: {
                    required: "请选择硬山搁檩"
                },
                wlgljcs: {
                    required: "请选择屋、楼盖拉结措施"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                wallRingBeam: {
                    required: "请选择墙体圈梁"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var woodFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#woodForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                cdType: {
                    required: true
                },
                zjzc: {
                    required: true
                },
                mzsj: {
                    required: true
                },
                zjyjclj: {
                    required: true
                },
                mzjslg: {
                    required: true
                },
                byteStatus: {
                    required: true
                },
                wallType: {
                    required: true
                },
                sjqtType: {
                    required: true
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                cwmgj: {
                    required: true
                },
                wallRingBeam: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                cdType: {
                    required: "请选择穿斗方式"
                },
                zjzc: {
                    required: "请选择柱间支撑"
                },
                mzsj: {
                    required: "请选择木柱梢径"
                },
                zjyjclj: {
                    required: "请选择柱脚与基础连接"
                },
                mzjslg: {
                    required: "请选择木柱接榫牢固"
                },
                byteStatus: {
                    required: "请选择节点状态"
                },
                wallType: {
                    required: "请选择围护墙体类型"
                },
                sjqtType: {
                    required: "请选择山尖墙体类型"
                },
                wallThick: {
                    required: "请填写墙体厚度"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                wallRingBeam: {
                    required: "请选择墙体圈梁"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var stoneFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#stoneForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallMaterial: {
                    required: true
                },
                czType: {
                    required: true
                },
                zhqlj: {
                    required: true
                },
                hqzdSpace: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                sxlcjgStyle: {
                    required: true
                },
                hqkdArea: {
                    required: true
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                cwmgj: {
                    required: true
                },
                ql: {
                    required: true
                },
                sjsgzz: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                wallMaterial: {
                    required: "请选择墙体材质"
                },
                czType: {
                    required: "请选择承重方式"
                },
                zhqlj: {
                    required: "请选择纵横墙连接"
                },
                hqzdSpace: {
                    required: "请填写横墙最大间距"
                },
                sxlcjgStyle: {
                    required: "请选择上下楼层结构形式"
                },
                hqkdArea: {
                    required: "请选择横墙开洞面积"
                },
                wallThick: {
                    required: "请填写墙体厚度"
                },
                roofType: {
                    required: "请选择屋盖类型"
                },
                floorType: {
                    required: "请选择楼盖类型"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                ql: {
                    required: "请选择圈梁"
                },
                sjsgzz: {
                    required: "请选择四角设构造柱"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var FILE_TYPES = {
        image: {
            title: '图片文件',
            extensions: 'jpg,jpeg,bmp,png,ico',
            mimeTypes: 'image/bmp,image/jpeg,image/png,image/x-icon'
        },
        doc: {
            title: '文档文件',
            extensions: 'doc,docx,xls,xlsx,ppt,pptx,pdf',
            mimeTypes: 'application/vnd.ms-excel.12,application/vnd.ms-word.document.12,application/vnd.ms-powerpoint.12,' +
                'application/pdf,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword'
        },
        video: {
            title: '视频文件',
            extensions: 'mp4,avi,mov,mpg',
            mimeTypes: 'video/mpeg,video/quicktime,video/x-msvideo,' +
                'application/vnd.rn-realmedia-vbr,video/mp4'
        },
        audio: {
            title: '音频文件',
            extensions: 'wma,mp3,wav',
            mimeTypes: 'audio/x-ms-wma,audio/mpeg,audio/x-wav'
        },
        packet: {
            titil: '压缩包',
            extensions: 'zip,rar',
            mimeTypes: 'application/zip,application/x-rar-compressed'
        }
    };
    var fileUpload = function () {
        require(['UtilDir/fileupload/multiFileUpload'], function (MFU) {
            var attachId = "";
            var settings = {
                placeAt: "multiFileUpload",
                allowMC:false,
                fileSizeLimit: 1024*1024*1024,
                /*
				1.0.2版本新增
				extendColumn:[
				    {name:"文件分类",filed:"category",format:function(file){return file.name}},
				    {name:"备注",filed:"remark",format:function(file){return '机密'}}
				],*/
                //data:["5a50d697c0af806aa01e06120d04f977","6c01e4492f264befab4c0532811f8dff"],
                onUploadSuccess: function (file) {
                    attachId += file.attachId + ",";
                    $("#detailFile").val(attachId.substr(0, attachId.length - 1));
                },
                onDeleteSavedFile: function (file) {
                    //console.log(file)
                }
            };
            var MFUpload = MFU.init(settings);

        });
    };
    var viewFileUpload = function (fileData) {
        require(['UtilDir/fileupload/multiFileUpload'], function (MFU) {
            var attachIdData = "";
            var attachId = "";
            var fileArray = fileData.split(',');
            if (fileData.length != 0) {
                attachIdData = fileData.split(',');
            }
            var settings = {
                placeAt: "multiFileUpload",
                allowMC:false,
                fileSizeLimit: 1024*1024*1024,
                /*
				1.0.2版本新增
				extendColumn:[
				    {name:"文件分类",filed:"category",format:function(file){return file.name}},
				    {name:"备注",filed:"remark",format:function(file){return '机密'}}
				],*/
                data: attachIdData,
                onUploadSuccess: function (file) {
                    attachId += file.attachId + ",";
                    if (fileData.length == 0) {
                        $("#detailFile").val(attachId.substr(0, attachId.length - 1));
                    } else {
                        $("#detailFile").val(fileData + "," + attachId.substr(0, attachId.length - 1));
                    }

                },
                onDeleteSavedFile: function (file) {
                    var index = fileArray.indexOf(file.attachId);
                    fileArray.splice(index, 1);
                    $("#detailFile").val(fileArray.toString());
                }
            };
            var MFUpload = MFU.init(settings);

        });
    };

    var initdivision = function () {
        var combotree = Combotree({
            // combo组件相关配置
            combo: {
                //要渲染的input的id
                id: "division",
                //下拉框的类型：单选or多选
                multi: false,
                key: {
                    idKey: "divisionId",
                    textKey: "divisionName"
                },
                //          placeholder: "请选择……",
                event: {
                    onShowPanel: function () {
                        console.log("show");
                    },
                    onHidePanel: function () {
                        console.log("hide");
                    },
                    onChange: function (n, o) {
                        debugger;
                        $("#divisionId").val(n[0].divisionId);
                        $("#division").val(n[0].divisionName);
                    }
                }
            },
            // ztree组件相关配置
            ztree: {
                data: {
                    simpleData: {
                        enable: true,
                        idKey: "divisionId", // 主键属性名
                        pIdKey: "parentId" // 父节点属性名
                    },
                    key: {
                        name: "divisionName" // 显示名称属性名
                    }
                },
                check: {
                    chkboxType: {
                        'Y': '',
                        'N': ''
                    }
                }
            },
            data: {
                url: getDivisionController() + 'initDivisionZtree',
                type: 'GET',
                success: function () {

                }
            },
            formatter: function (node) {
                node.open = false;
            },
            value: $("#divisionId").val(),
            search: {
                enable: true,
                fields: ["divisionName"]
            }
        });
    }
    var initDivisionForm = function () {

        OrgUtil.init({
            id: "qualityName",
            multi: true,
            title: "请选择人员",
            hideTag: true,
            tagType: ["user"],
            callback: function (data) {
                debugger;
                //          	$("#groupUserId").val(data.user[0].userId);
                //              $("#groupMember").val(data.user[0].userName);
                //              $("#groupMobilePhone").val(data.user[0].mobilePhone);
                docData = data.user;
                var rows = data.user;
                var members = "";
                var membersIds = "";
                $.each(rows, function (i, row) {
                    members += row.userName + ",";
                    membersIds += row.userId + ",";
                });
                members = members.substr(0, members.length - 1);
                $("#qualityName").val(members);

                //				membersIds = membersIds.substr(0,membersIds.length - 1);
                //              $("#groupUserId").val(membersIds);
            }
        });
    };
    return {
        init: init
    };
});

var replayMap;